/*
 * @author Jordi Mateo
 * @author Sergi Builtrago
 * @author Marc Gonzalez
 * @author Aitor Garcia
 * @version 23.12.2012
 */

package com.example.project;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.widget.GridView;

public class Project_Menu extends Activity {
	private GridAdapter gridAdapt;
	private ArrayList<String> mItems = new ArrayList<String>();
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		if (Integer.valueOf(android.os.Build.VERSION.SDK_INT) >= 9) {
	        try {
	            // StrictMode.setThreadPolicy(StrictMode.ThreadPolicy.LAX);
	            Class<?> strictModeClass = Class.forName("android.os.StrictMode", true, Thread.currentThread()
	                    .getContextClassLoader());
	            Class<?> threadPolicyClass = Class.forName("android.os.StrictMode$ThreadPolicy", true, Thread.currentThread()
	                    .getContextClassLoader());
	            Field laxField = threadPolicyClass.getField("LAX");
	            Method setThreadPolicyMethod = strictModeClass.getMethod("setThreadPolicy", threadPolicyClass);
	            setThreadPolicyMethod.invoke(strictModeClass, laxField.get(null));
	        } catch (Exception e) {
	        }
	    }
		
		setContentView(R.layout.activity_project__menu);

		for (int i = 0; i<6; i++) {
	    	mItems.add(Integer.toString(i));
	    	}
	    gridAdapt = new GridAdapter(this, mItems);	
	    GridView g = (GridView) findViewById(R.id.gridView1);
	    g.setAdapter(gridAdapt);
	    g.setOnItemClickListener(new GridItemClicker() {
		});
		}
		@Override
		public boolean onCreateOptionsMenu(Menu menu) {
			// Inflate the menu; this adds items to the action bar if it is present.
			getMenuInflater().inflate(R.menu.activity_project__menu, menu);
			return true;
	}
	
	//es problema amb els imports no se per que no guarda, si veus aixo clica els botons i ves afegint tots els imputs

}